package com.workhours.vo;

import com.workhours.entity.RestRecord;

import java.time.LocalDate;
import java.util.List;

/**
 * 用户状态响应VO
 *
 * @author WorkHours
 * @since 2025-09-19
 */
public class UserStatusResponse {
    
    private LocalDate tripStartDate;
    private List<RestRecordVO> restRecords;
    
    // 构造函数
    public UserStatusResponse() {}
    
    public UserStatusResponse(LocalDate tripStartDate, List<RestRecordVO> restRecords) {
        this.tripStartDate = tripStartDate;
        this.restRecords = restRecords;
    }
    
    // Getters and Setters
    public LocalDate getTripStartDate() {
        return tripStartDate;
    }
    
    public void setTripStartDate(LocalDate tripStartDate) {
        this.tripStartDate = tripStartDate;
    }
    
    public List<RestRecordVO> getRestRecords() {
        return restRecords;
    }
    
    public void setRestRecords(List<RestRecordVO> restRecords) {
        this.restRecords = restRecords;
    }
    
    @Override
    public String toString() {
        return "UserStatusResponse{" +
                "tripStartDate=" + tripStartDate +
                ", restRecords=" + restRecords +
                '}';
    }
    
    /**
     * 休息记录VO
     */
    public static class RestRecordVO {
        private Long id;
        private LocalDate startDate;
        private LocalDate endDate;
        private String description;
        private String status;
        private String createTime;
        
        // 构造函数
        public RestRecordVO() {}
        
        public RestRecordVO(RestRecord record) {
            this.id = record.getId();
            this.startDate = record.getStartDate();
            this.endDate = record.getEndDate();
            this.description = record.getDescription();
            this.status = record.getEndDate() == null ? "ongoing" : "completed";
            this.createTime = record.getCreateTime().toString();
        }
        
        // Getters and Setters
        public Long getId() {
            return id;
        }
        
        public void setId(Long id) {
            this.id = id;
        }
        
        public LocalDate getStartDate() {
            return startDate;
        }
        
        public void setStartDate(LocalDate startDate) {
            this.startDate = startDate;
        }
        
        public LocalDate getEndDate() {
            return endDate;
        }
        
        public void setEndDate(LocalDate endDate) {
            this.endDate = endDate;
        }
        
        public String getDescription() {
            return description;
        }
        
        public void setDescription(String description) {
            this.description = description;
        }
        
        public String getStatus() {
            return status;
        }
        
        public void setStatus(String status) {
            this.status = status;
        }
        
        public String getCreateTime() {
            return createTime;
        }
        
        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }
        
        @Override
        public String toString() {
            return "RestRecordVO{" +
                    "id=" + id +
                    ", startDate=" + startDate +
                    ", endDate=" + endDate +
                    ", description='" + description + '\'' +
                    ", status='" + status + '\'' +
                    ", createTime='" + createTime + '\'' +
                    '}';
        }
    }
}
